package com.pshcp.doctor.tool;

import com.pshcp.doctor.vo.doctordept.DoctorDeptVO;
import com.pshcp.domain.model.Dept;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Description: TODO
 * @Author: xiaoche
 * @Date: 2022/11/8 21:03
 */
public class DoctorDeptTool {

    public static List<DoctorDeptVO> buildGetDoctorDeptList(List<Dept> deptList) {
        if (CollectionUtils.isEmpty(deptList)) {
            return Collections.emptyList();
        }
        List<DoctorDeptVO> list = new ArrayList<>();
        deptList.forEach(dept -> {
            DoctorDeptVO doctorDeptVO=new DoctorDeptVO();
            doctorDeptVO.setDeptId(dept.getId());
            doctorDeptVO.setDeptName(dept.getHisDeptName());
            list.add(doctorDeptVO);
        });
        return list;
    }
}
